//
//  ZWSlideView.m
//  08.音乐播放器
//
//  Created by mac on 16/3/17.
//  Copyright © 2016年 itheima. All rights reserved.
//

#import "ZWSlideView.h"
#import "Masonry.h"

@interface ZWSlideView()

@property (weak,nonatomic) UILabel *timeLabel;
@property (weak,nonatomic) UILabel *titleLabe;
@property (weak,nonatomic) UIButton *palyButton;
@property (weak,nonatomic) UIImageView *imageView;

@end

@implementation ZWSlideView

- (instancetype)initWithCoder:(NSCoder *)aDecoder{

    if (self = [super initWithCoder:aDecoder]) {
        [self setup];
    }
    return self;
}
- (instancetype)initWithFrame:(CGRect)frame{

    if (self = [super initWithFrame:frame]) {
        [self setup];
    }
    return self;
}
- (void)setup{

    //实例化
    UILabel *timeLabel = [[UILabel alloc]init];
    self.timeLabel = timeLabel;
    [self addSubview:timeLabel];

    UILabel *titleLabel = [[UILabel alloc]init];
    self.titleLabe = titleLabel;
    [self addSubview:titleLabel];
    
    UIButton *playButton = [[UIButton alloc]init];
    self.palyButton = playButton;
    [self addSubview:playButton];
    
    UIImageView *imageView = [[UIImageView alloc]init];
    self.imageView = imageView;
    [self addSubview:imageView];
    
    //约束
    [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(8);
        make.centerY.mas_equalTo(self);
    }];
    [self.titleLabe mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.mas_equalTo(self);
    }];
    [self.palyButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(8);
        make.centerY.mas_equalTo(self);
        make.height.width.mas_equalTo(30);
    }];
    [self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(0);
    }];
}





@end
